<template>
  <div>
    <el-form :model="investorsForm" label-width="100px">
      <el-form-item label="序号" prop="id">
        <el-input v-model="investorsForm.id" disabled></el-input>
      </el-form-item>
      <el-form-item label="投资商姓名" prop="investorName">
        <el-input v-model="investorsForm.investorName"></el-input>
      </el-form-item>
      <el-form-item label="手机号" prop="phoneNumber">
        <el-input v-model="investorsForm.phoneNumber"></el-input>
      </el-form-item>
      <el-form-item label="是否客户" prop="isCustomer">
        <el-radio-group v-model="investorsForm.isCustomer">
          <el-radio :label="1">是</el-radio>
          <el-radio :label="0">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="投资类型" prop="investmentType">
        <el-select v-model="investorsForm.investmentType" placeholder="请选择">
          <el-option label="投资入股" value="投资入股"></el-option>
          <el-option label="合作加盟" value="合作加盟"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="出资金额" prop="investmentAmount">
        <el-input-number v-model="investorsForm.investmentAmount" :precision="2"></el-input-number>
      </el-form-item>
      <el-form-item label="投资项目" prop="project">
        <el-input v-model="investorsForm.project"></el-input>
      </el-form-item>
      <el-form-item label="涉及电站" prop="station">
        <el-input v-model="investorsForm.station"></el-input>
      </el-form-item>
      <el-form-item label="创建时间" prop="createdAt">
        <el-date-picker
            v-model="investorsForm.createdAt"
            type="datetime"
            placeholder="选择日期时间"
            value-investorFormat="yyyy-MM-dd HH:mm:ss"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitInvestorsForm">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup lang="ts">
import {reactive} from 'vue';
import router from "../../../../router";
import {postInvestors} from "../../../../api/InvestorsApi.ts";

// 表单数据
const investorsForm = reactive({
  id: 0,
  investorName: '',
  phoneNumber: '',
  isCustomer: 0,
  investmentType: '',
  investmentAmount: 0,
  project: '',
  station: '',
  createdAt: ''
});



const submitInvestorsForm = async () => {
  const res = await postInvestors(investorsForm)
  if (res.code === 200) {
    await router.push("/home/partner/investor/list")
  }
}
</script>

<style scoped>
/* 可以在这里添加样式 */
</style>
